<template>
  <div class="home">
    <div class="content-wrapper">
      <div class="top-section">
        <div class="left-nav">
          <HomeNav />
        </div>
        <div class="right-carousel">
          <el-carousel :interval="4000" arrow="always" height="400px">
            <el-carousel-item v-for="item in carouselItems" :key="item.id">
              <img :src="item.imageUrl" alt="轮播图" class="carousel-img">
            </el-carousel-item>
          </el-carousel>
          <div class="text"><p>简易购 安心购</p></div>
        </div>
      </div>
      <div class="product-column">
        <HomeProduct />
      </div>
    </div>
  </div>
</template>

<script>
import HomeNav from "../views/HomeNav.vue";
import HomeProduct from "../views/HomeProdunct.vue";
export default {
  name: 'HomeView',
  components: {
    HomeNav,
    HomeProduct
  },
  data() {
    return {
      carouselItems: [
        { id: 1, imageUrl: require('../assets/images/slide4.jpg') },
        { id: 2, imageUrl: require('../assets/images/slide5 .png') },
        { id: 3, imageUrl: require('../assets/images/slide6.png') }
      ]
    };
  }
};
</script>

<style scoped>
.home {
  padding: 20px;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.top-section {
  display: flex;
  gap: 80px; 
}

.left-nav {
  width: 300px; 
}

.right-carousel {
  flex: 1;
  margin-left: 35px;
  padding-right: 130px;
}

.carousel-img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  border-radius: 8px; 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-column {
  width: calc(100% - 130px); 
  margin-left: auto; 
  padding: 0 20px;
  box-sizing: border-box;
}

.product-column .product {
  display: flex;
  flex-direction: column; 
  gap: 20px;
  padding: 0;
}

.product-column .pro {
  width: 100% !important;
  margin: -20px;
}

.product-column .product .pro {
  width: 100% !important;
}

.text {
  text-align: center;
  font-size: 24px;
  color: #333;
  margin-top: 0px;
}

@media (max-width: 992px) {
  .top-section {
    flex-direction: column;
    gap: 20px;
  }
  
  .left-nav {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .right-carousel {
    width: 100%;
  }
  
  .product-column {
    width: 100%;
    padding: 0 10px;
  }
}
</style>
